<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-09 10:07:06
 * @LastEditTime: 2019-10-17 14:13:05
 * @LastEditors: Please set LastEditors
 -->
<template>
  <div class="myren animated bounceInRight">
    <div class="header">
      <div @click="histry">
        <img src="../assets/histry.png">
        返回
      </div>
      <span class="reg" style="margin-left:-0.3rem;">我的认证</span>
      <span class="log"></span>
    </div>
    <div class="con">
        <ul>
            <li @click="jin_geren">
                <div class="left">
                    <img src="../assets/you_xin.png" alt="">
                    个人邮箱认证
                </div>
                <div class="right">
                    <span :class="ge_ren?'text1':'text2'">{{renzheng1}}</span>
                    <img src="../assets/right_jiantou.png" alt="">
                </div>
                <div class="dian_quan"></div>
            </li>
            <!-- <li @click="jin_qiren">
                <div class="left">
                    <img src="../assets/qi_xin.png" alt="">
                    企业认证
                </div>
                <div class="right">
                    <span :class="qiye_ren?'text1':'text2'">{{renzheng2}}</span>
                    <img src="../assets/right_jiantou.png" alt="">
                </div>
                <div class="dian_quan"></div>
            </li> -->
        </ul>
    </div>
  </div>
</template>

<script>
import { check_login,get_my_info } from "../api/api.js";
export default {
  name: "myren",
  data() {
    return {
      baocun:true,
      phone:'',
      renzheng1:'',
      renzheng2:'',
      ge_ren:'',
      qiye_ren:''
    };
  },
  mounted() {
    if (sessionStorage.getItem("mobile") != null) {
      this.phone = JSON.parse(sessionStorage.getItem("mobile"));
    }
    check_login({
      data: {
        mobile: this.phone
      }
    }).then(res => {
      if (res.data.code == 11001) {
      } else if (res.data.code == 11000) {
        this.$toast("未登录，请重新登录");
        this.$router.push("/");
      }
    });
  },
  created(){
    var user_id=''
    if (sessionStorage.getItem("data_mobal") != null) {
      user_id = JSON.parse(
        JSON.parse(sessionStorage.getItem("data_mobal"))
      ).user_id;
    }
    get_my_info({data:{
      user_id:user_id
    }}).then(res=>{
      console.log(JSON.parse(res.data.body.data))
      var date=JSON.parse(res.data.body.data)
      if(res.data.code==10069){
        if(date.email_flag==0){
          this.renzheng1='未认证'
          this.ge_ren=false
        }else if(date.email_flag==1){
          this.renzheng1='已认证'
          this.ge_ren=true
        }
        if(date.ent_info.mng_status==0){
          this.renzheng2='未认证'
          this.qiye_ren=false
        }else if(date.ent_info.mng_status==1){
          this.renzheng2='已认证'
          this.qiye_ren=true
        }
      }else if(res.data.code==10070){
        this.$toast('获取信息失败')
      }
    })
  },
  watch: {},
  methods: {
    // 返回上一层
    histry() {
      this.$router.push('/mine');
    },
    jin_geren(){
        this.$router.push('/geren')
    },
    jin_qiren(){
        this.$router.push('/qiren')
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.myren {
  height: 100vh;
  background: #EEEEEE;
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 0.5rem;
    line-height: 0.5rem;
    padding: 0 0.15rem;
    border-bottom: 0.01rem solid #eee;
    background-color: #fff;
    div {
      display: flex;
      justify-content: left;
      align-items: center;
      color: #979797;
      font-size: 0.14rem;
      img {
        height: 0.16rem;
        width: 0.08rem;
        margin-right: 0.08rem;
      }
    }
    .reg {
      font-size: 0.18rem;
      color: #1a2533;
      font-weight: 500;
    }
    .log {
      font-size: 0.14rem;
      color: #e82716;
      font-weight: bold;
    }
  }
  .con{
      ul{
          li{
              display: flex;
              align-items: center;
              justify-content: space-between;
              margin-top:0.1rem;
              height:0.6rem;
              background:#fff;
              overflow: hidden;
              .left{
                    display: flex;
                    align-items: center;
                    justify-content: left;
                    font-size: 0.14rem;
                    color:#1A2533;
                  img{
                      height:0.3rem;
                      width:0.3rem;
                      margin: 0 0.2rem 0 0.15rem;
                  }
              }
              .right{
                  display: flex;
                    align-items: center;
                    justify-content: right;
                  span{
                      font-size: 0.1rem;
                  }
                  .text1{
                      color: #6ABFA7
                  }
                  .text2{
                      color:#E82716;
                  }
                  img{
                      height:0.1rem;
                      width:0.06rem;
                      margin: 0 0.15rem 0 0.1rem;
                      display: block
                  }
              }
              .dian_quan{
                    height:0.3rem;
                    width:0.3rem;
                    position: absolute;
                    left: 50%;
                    margin-left:-0.15rem;
                    border-radius: 50%;
                    transition: 0.5s all;
                }
                &:hover,&:active{
                    .dian_quan{
                    background: rgba(190,190,190,0.2);
                    box-shadow:0px 0px 0.5rem 0.1rem rgba(190,190,190,0.5);
                    }
                }
          }
      }
  }
}
</style>
